home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / batchut / batutl2.zip / PAUSE2.ASM < prev    next >
Assembly Source File  |  1988-04-20  |  2KB  |  64 lines

  1. TITLE    PAUSE2    11-4-84    [4-16-88]
  2. ;Toad Hall Disassembly, thorough hack
  3.  
  4. LF    EQU    0AH
  5. CR    EQU    0DH
  6. ;
  7. ;INITIAL VALUES :    CS:IP    0000:0100
  8. ;            SS:SP    0000:FFFF
  9.  
  10. CodeSeg    SEGMENT
  11.     ASSUME DS:CodeSeg,SS:CodeSeg,CS:CodeSeg,ES:CodeSeg
  12.     ORG    100H
  13.  
  14. Pause2    proc    near
  15.     CLD                ;insure fwd
  16.  
  17. ;The original code had all sorts of mess with copying the PSP
  18. ;command line into an internal 100H-byte buffer, changing segment
  19. ;registers (DS and ES) to point to that internal buffer start,
  20. ;etc.  Donno WHY he messed with all that when it's much MUCH easier
  21. ;to deal with the PSP command line right from the start!
  22. ; We KNOW the first byte is the length byte, the next byte (if any
  23. ;length) will be a space, and the rest of the length will be characters,
  24. ;terminating with a CR.
  25.  
  26.     MOV    SI,80H            ;DOS PSP cmd line start
  27.     LODSB                ;snarf length byte
  28.     or    al,al            ;anything there?
  29.     je    Get_Key            ; nope, just to right to kbd input
  30.  
  31.     dec    al            ;adjust for trailing CR
  32.     MOV    CL,AL            ;save in cl
  33.     XOR    CH,CH            ;clear msb to use as counter
  34.     LODSB                ;snarf first cmd line char (space)
  35.                     ; and throw it away
  36.     mov    ah,2            ;prepare for Display Output
  37.  
  38. Lup223:    LODSB                ;snarf first cmd line char
  39.     CMP    AL,CR            ;done? (just in case our count is off)
  40.     je    Get_Key            ; done, go get kbd input
  41.      mov    dl,al            ;need it in DL
  42.      int    21H            ;display it
  43.      LOOP    Lup223            ; and keep looping
  44.  
  45. Get_Key:
  46.     mov    ax,0C01H        ;Clear kbd, do Func 1
  47.     INT    21H            ; (kbd input w/echo)
  48.  
  49. ;Just for giggles (and to maybe add some functionality to this thing..)
  50. ;we'll return the keyboard input character's ASCII value as the Errorlevel:
  51.     mov    bx,ax            ;save AL (kbd input) a sec
  52.     mov    dx,offset CrLf        ;string offset
  53.     mov    ah,9            ;display string
  54.     int    21H
  55.     mov    ax,bx            ;restore char as Errorlevel
  56.     mov    ah,4CH            ;terminate
  57.     int    21H
  58.  
  59. CrLf    db    CR,LF,'$'
  60. Pause2    endp
  61.  
  62.     CodeSeg    ENDS
  63.     END    Pause2
  64.